package com.ryan.mdp.jta;

import org.springframework.jdbc.core.JdbcTemplate;

import com.ryan.mdp.api.normal.DemoMdpService;

public class ClientServiceImpl implements ClientService {

    private DemoMdpService demo;

    private JdbcTemplate jdbcTemplate;

    public void testRollback() {
        getJdbcTemplate().execute("insert into Test2(ID, TIME) values(2, CURRENT_TIMESTAMP)");
        demo.echo("test");
        throw new RuntimeException("client");
    }

    public void testNormal() {
        getJdbcTemplate().execute("insert into Test2(ID, TIME) values(1, CURRENT_TIMESTAMP)");
        demo.echo("test");
    }

    public DemoMdpService getDemo() {
        return demo;
    }

    public void setDemo(DemoMdpService demo) {
        this.demo = demo;
    }

    public JdbcTemplate getJdbcTemplate() {
        return jdbcTemplate;
    }

    public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

}
